from __future__ import unicode_literals
import requests
from bs4 import BeautifulSoup
import time
import json

url='https://porn15s.com/random'
count=0

while(True):
    try:

        r=requests.get(url,timeout=30)
        content=r.content
        soup=BeautifulSoup(content,'lxml')
        mp4url=soup.find('source',attrs={'id':'mp4Source'})['src']+'\n'

        with open('n15s.txt','a',encoding='utf-8') as f:
            f.write(mp4url)
        count=count+1
        with open('n15scount.txt','w+',encoding='utf-8') as ff:
            ff.write(str(count))
    except Exception as e:
        print(e)
    finally:
        time.sleep(3)
        print(count,end='\r')

